﻿using System;

/*
 * Write a boolean expression for finding if the bit 3 (counting from 0) of a given integer is 1 or 0.
 */

class IsThirdBit1
{
    static void Main(string[] args)
    {
        //int parameter = 8;
        int parameter = 9;
        //int parameter = 16;
        int position = 3;
        int mask = 1<<position;
        int paramaterAndMask = parameter&mask;
        int result = paramaterAndMask>>position;
        String parameterBinary = Convert.ToString(parameter, 2).PadLeft(32, '0');
        Console.WriteLine("The bit in position {0} of {1} = {2} is {3}",position, parameter, parameterBinary, result);

    }
}